﻿<Window x:Name="window" x:Class="Daytimer.Toasts.Toast"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Height="90" Width="385"
		ShowInTaskbar="False" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True"
		Background="Transparent" Foreground="#FFFFFFFF" FontSize="15" TextOptions.TextRenderingMode="ClearType"
		TextOptions.TextFormattingMode="Display" FontFamily="Segoe UI, /Daytimer.Fonts;component/#WeblySleek UI Normal"
		FontWeight="Normal" SnapsToDevicePixels="True" UseLayoutRounding="True" ShowActivated="False" Topmost="True"
		Focusable="False">
	<Window.Triggers>
		<EventTrigger RoutedEvent="Loaded">
			<BeginStoryboard>
				<Storyboard>
					<DoubleAnimation To="1" Duration="0:0:0.1" Storyboard.TargetName="outerBorder"
							Storyboard.TargetProperty="Opacity" />
					<DoubleAnimation To="0" Duration="0:0:0.4" Storyboard.TargetName="translateTransform"
							Storyboard.TargetProperty="X">
						<DoubleAnimation.EasingFunction>
							<QuarticEase EasingMode="EaseOut" />
						</DoubleAnimation.EasingFunction>
					</DoubleAnimation>
				</Storyboard>
			</BeginStoryboard>
		</EventTrigger>
		<EventTrigger RoutedEvent="MouseEnter">
			<BeginStoryboard>
				<Storyboard>
					<DoubleAnimation To="1" Duration="0:0:0.1" Storyboard.TargetName="dismissButton"
							Storyboard.TargetProperty="Opacity" />
				</Storyboard>
			</BeginStoryboard>
		</EventTrigger>
		<EventTrigger RoutedEvent="MouseLeave">
			<BeginStoryboard>
				<Storyboard>
					<DoubleAnimation To="0" Duration="0:0:0.1" Storyboard.TargetName="dismissButton"
							Storyboard.TargetProperty="Opacity" />
				</Storyboard>
			</BeginStoryboard>
		</EventTrigger>
		<EventTrigger RoutedEvent="MouseLeftButtonDown">
			<BeginStoryboard>
				<Storyboard>
					<DoubleAnimation To="0.97" Duration="0:0:0.2" Storyboard.TargetName="scaleTransform"
							Storyboard.TargetProperty="ScaleX">
						<DoubleAnimation.EasingFunction>
							<QuarticEase />
						</DoubleAnimation.EasingFunction>
					</DoubleAnimation>
					<DoubleAnimation To="0.97" Duration="0:0:0.2" Storyboard.TargetName="scaleTransform"
							Storyboard.TargetProperty="ScaleY">
						<DoubleAnimation.EasingFunction>
							<QuarticEase />
						</DoubleAnimation.EasingFunction>
					</DoubleAnimation>
				</Storyboard>
			</BeginStoryboard>
		</EventTrigger>
		<EventTrigger RoutedEvent="MouseLeftButtonUp">
			<BeginStoryboard>
				<Storyboard>
					<DoubleAnimation To="1" Duration="0:0:0.3" Storyboard.TargetName="scaleTransform"
							Storyboard.TargetProperty="ScaleX">
						<DoubleAnimation.EasingFunction>
							<QuarticEase />
						</DoubleAnimation.EasingFunction>
					</DoubleAnimation>
					<DoubleAnimation To="1" Duration="0:0:0.3" Storyboard.TargetName="scaleTransform"
							Storyboard.TargetProperty="ScaleY">
						<DoubleAnimation.EasingFunction>
							<QuarticEase />
						</DoubleAnimation.EasingFunction>
					</DoubleAnimation>
				</Storyboard>
			</BeginStoryboard>
		</EventTrigger>
	</Window.Triggers>
	<Border x:Name="outerBorder" BorderThickness="2" BorderBrush="{DynamicResource AlertBorder}"
			Background="{DynamicResource AlertBackground}" Height="90" Width="385" Opacity="0"
			RenderTransformOrigin="0.5,0.5" RenderOptions.BitmapScalingMode="LowQuality">
		<Border.RenderTransform>
			<TransformGroup>
				<ScaleTransform x:Name="scaleTransform" ScaleX="1" ScaleY="1" />
				<TranslateTransform x:Name="translateTransform" X="10" />
			</TransformGroup>
		</Border.RenderTransform>
		<Grid>
			<Grid.CacheMode>
				<BitmapCache />
			</Grid.CacheMode>
			<Grid Margin="18,12,65,14" IsHitTestVisible="False">
				<Grid.RowDefinitions>
					<RowDefinition />
					<RowDefinition />
					<RowDefinition />
				</Grid.RowDefinitions>
				<TextBlock Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
						FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
				<TextBlock x:Name="line1Text" Text="Line 1" Grid.Row="1" TextTrimming="CharacterEllipsis" />
				<TextBlock x:Name="line2Text" Text="Line 2" Grid.Row="2" TextTrimming="CharacterEllipsis" />
			</Grid>
			<Button x:Name="dismissButton" HorizontalAlignment="Right" VerticalAlignment="Top" Width="30" Height="30"
					MinWidth="0" Margin="0,-2,-2,0" Opacity="0" Click="dismissButton_Click">
				<Button.Template>
					<ControlTemplate TargetType="Button">
						<Border x:Name="border" Background="Transparent">
							<Path x:Name="path" Stroke="#FFFFFFFF" StrokeThickness="2" Data="M 0 0 10 10 M 10 0 0 10"
									HorizontalAlignment="Center" VerticalAlignment="Center" />
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter Property="Background" TargetName="border" Value="#21FFFFFF" />
							</Trigger>
							<Trigger Property="IsPressed" Value="True">
								<Setter Property="Background" TargetName="border" Value="#FFFFFFFF" />
								<Setter Property="Stroke" TargetName="path"
										Value="{Binding Background, ElementName=outerBorder}" />
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Button.Template>
			</Button>
			<Image Source="{Binding Icon, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
					HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,18,7" Width="32" Height="32"
					IsHitTestVisible="False" />
			<MediaElement x:Name="mediaElement" Visibility="Collapsed" Volume="100" LoadedBehavior="Manual"
					Loaded="mediaElement_Loaded" MediaEnded="mediaElement_MediaEnded" />
		</Grid>
	</Border>
</Window>